package com.qyhl.webtv.commonlib.item.fuquan;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.makeramen.roundedimageview.RoundedImageView;
import com.qyhl.webtv.commonlib.R;
import com.qyhl.webtv.commonlib.entity.news.GlobalNewsBean;
import com.zhy.adapter.recyclerview.base.ItemViewDelegate;
import com.zhy.adapter.recyclerview.base.ViewHolder;

public class ItemFuQuanAdvGroup implements ItemViewDelegate<GlobalNewsBean> {
    private Context context;

    public ItemFuQuanAdvGroup(Context context) {
        this.context = context;
    }

    @Override
    public int getItemViewLayoutId() {
        return R.layout.item_fuquan_adv_group;
    }

    @Override
    public boolean isForViewType(GlobalNewsBean item, int position) {
        return "4".equals(item.getType()) && item.getNewsStyle() == 2;
    }

    @Override
    public void convert(ViewHolder holder, GlobalNewsBean bean, int position) {
        RoundedImageView cover = holder.getView(R.id.cover);

        Glide.with(context)
                .load(bean.getCover())
                .apply(new RequestOptions().placeholder(R.drawable.cover_normal_default).error(R.drawable.cover_normal_default))
                .into(cover);

        holder.setText(R.id.title, bean.getTitle());
    }
}
